package ua.epam.muzalevskiy.traction.dao;

import java.util.List;
import ua.epam.muzalevskiy.traction.dao.exceptions.DatabaseException;
import ua.epam.muzalevskiy.traction.dao.exceptions.NotExistsParameterException;
import ua.epam.muzalevskiy.traction.dao.exceptions.NotUniqueParameterException;
import ua.epam.muzalevskiy.traction.route.Stop;
import ua.epam.muzalevskiy.traction.route.Route;

/**
 * This interface defines methods that needed to select, insert, update, delete
 * data from DataBase.
 *
 * @author Muzalevskiy Vitaliy
 */ 
public interface StopDao {

    /**
     * Add new <code> Stop </code> value to DataBase.
     *
     * @param stop - concrete <code> Stop </code> value.     
     * @throws NotUniqueRouteNumberException if <code> Stop </code> with
     *      such parameters already exists in DataBase.
     */
    void addStop(Stop stop) throws NotUniqueParameterException;

    /**
     * Selects all Stops in DataBase. 
     * 
     * @return <code> List </code> of <code> Stop </code>. 
     */
    List<Stop> selectAll();

    /**
     * Method to get stop from DataBase with concrete ID.
     * 
     * @param stopID ID value of current stop.
     * @return <code> Stop </code> value. 
     */
    Stop selectStopByID(int stopID);

    /**
     * Method need to get stop by it coordinates.
     * 
     * @return <code> Stop </code> value. 
     */
    Stop selectStopByCoordinates(double latitude, double longitude);

    /**
     * Selects all bus Stops in DataBase. 
     * 
     * @return <code> List </code> of <code> Stop </code>.
     */
    List<Stop> selectBusStops();

    /**
     * Selects all trolleybus Stops in DataBase. 
     * 
     * @return <code> List </code> of <code> Stop </code>.
     */
    List<Stop> selectTrolleybusStops();

    /**
     * Selects all tram Stops in DataBase. 
     * 
     * @return <code> List </code> of <code> Stop </code>.
     */
    List<Stop> selectTramStops();

    /**
     * Delete stop with concrete ID.                                                                                                                                                                                                                                                                                                  
     *
     * @param stopID - ID of concrete stop.
     * @throws NotExistsParameterException if there is no stop with
     *      such ID in DataBase.
     */
    void deleteStopByID(int stopID) throws NotExistsParameterException;

    /**
     * Method change the type of current stop.
     * 
     * @throws DatabaseException
     */
    void changeStopType(int stopID, boolean busType,
            boolean trolleybusType, boolean tramType)
            throws DatabaseException;

    /**
     * Method return list of Stops.
     * @return <code> List </code> of <code> Stop </code>.
     */
    List<Route> getStopRoutes(int stopID);
}
